//
//  GoodAandbadViewController.m
//  FoodFamily
//
//  Created by dlios on 15-6-20.
//  Copyright (c) 2015年 guoBang. All rights reserved.
//

#import "GoodAandbadViewController.h"

@interface GoodAandbadViewController ()
@property(nonatomic,retain)NSMutableArray *GoodArray;
@property(nonatomic,retain)NSMutableArray *fittingarray;
@property(nonatomic,retain)NSMutableArray *gramarray;
@end

@implementation GoodAandbadViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];

    self.navigationItem.title = @"相宜相克";
     self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"iconfont-fanhui.png"] style:UIBarButtonItemStylePlain target:self action:@selector(qwer)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor];
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"beijing.png"]];
    [self GoodAFN];

    
    
}
-(void)GoodAFN
{
    self.GoodArray = [NSMutableArray array];
    self.fittingarray = [NSMutableArray array];
    self.gramarray = [NSMutableArray array];

    
    NSString *string = [NSString stringWithFormat:@"http://121.41.88.194:80/HandheldKitchen/api/vegetable/tblvegetable!getIntelligentChoice.do?vegetable_id=%@&type=3&phonetype=0&is_traditional=0",self.movie.vegetable_id];
    
    
[AFNGetDataValue getDataAFN:string block:^(NSMutableDictionary *dataDic) {
  
    NSMutableArray *array = [dataDic objectForKey:@"data"];
#pragma array data 中 第一个dic
    //NSMutableDictionary *onedic =[array firstObject];

    GoodandpedView *goodped = [[GoodandpedView alloc]init];
    goodped.frame = [UIScreen mainScreen].bounds;
    goodped.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:goodped];

    for (NSMutableDictionary *dic in array) {
        Movie *moive = [[Movie alloc] init];
        [moive setValuesForKeysWithDictionary:dic];
        
        [self.GoodArray addObject:moive];
    }
    
    for (Movie *moive in self.GoodArray) {
        //NSLog(@"%@",moive.imageName);
        for (NSMutableDictionary *dic in moive.Gram) {
            
            Movie *movie1 = [[Movie alloc] init];
            movie1.contentDescription1 = [dic objectForKey:@"contentDescription"];
            [movie1 setValuesForKeysWithDictionary:dic];
            [self.gramarray addObject:movie1];
        }
        for (NSMutableDictionary *dic in moive.Fitting) {
           // NSLog(@"/////%@",[dic objectForKey:@"contentDescription"]);
            Movie *movie2 = [[Movie alloc] init];
            movie2.contentDescription1 =[dic objectForKey:@"contentDescription"];
            [movie2 setValuesForKeysWithDictionary:dic];
            [self.fittingarray addObject:movie2];
            //NSLog(@"1111%@",movie2.contentDescription1);
        }
       }

    
    goodped.gooarray = self.GoodArray;
    goodped.fittingarray = self.fittingarray;
    goodped.gramarray = self.gramarray;
    [goodped qwer];
    
//    GoodandpedView *goodandped = [[GoodandpedView alloc]initWithFrame:[[UIScreen mainScreen]bounds]and:self.GoodArray];
//    goodandped.backgroundColor = [UIColor yellowColor];
////    goodandped.movi =[self.GoodArray firstObject];
//   
//    NSLog(@"goodandped.movi.imageName1 ==%@",self.GoodArray);
//    [self.view addSubview:goodandped];
////   }];
////    
    
}];
}
-(void)qwer
{
    [self.navigationController popViewControllerAnimated:YES];

}
    
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
